﻿using System.Data;
using System.Data.SqlClient;
namespace MyWeb.Data
{
	public class tblCLASSROOMDAL : SqlDataProvider
	{

		#region[tblCLASSROOM_GetbyAll]
		public DataTable tblCLASSROOM_GetByAll()
		{
			using (var cmd = new SqlCommand("sp_tblCLASSROOM_GetByAll", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCLASSROOM_GetbyId]
		public DataTable tblCLASSROOM_GetById(string CLASSROOM_CODE)
		{
			using (var cmd = new SqlCommand("sp_tblCLASSROOM_GetById", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CLASSROOM_CODE", CLASSROOM_CODE));return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCLASSROOM_GetbyTop]
		public DataTable tblCLASSROOM_GetByTop(string Top, string Where, string Order)
		{
			using (var cmd = new SqlCommand("sp_tblCLASSROOM_GetByTop", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				cmd.Parameters.Add(new SqlParameter("@Top",Top));
				cmd.Parameters.Add(new SqlParameter("@Where",Where));
				cmd.Parameters.Add(new SqlParameter("@Order",Order));
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCLASSROOM_GetbyCENTER_CODE]
		public DataTable tblCLASSROOM_GetByCENTER_CODE(string CENTER_CODE)
		{
			using (var cmd = new SqlCommand("sp_tblCLASSROOM_GetByCENTER_CODE", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CENTER_CODE", CENTER_CODE));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblCLASSROOM_Insert]
		public void tblCLASSROOM_Insert(tblCLASSROOMInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblCLASSROOM_Insert", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CLASSROOM_CODE", Data.CLASSROOM_CODE));
				cmd.Parameters.Add(new SqlParameter("@CLASSROOM_NAME", Data.CLASSROOM_NAME));
				cmd.Parameters.Add(new SqlParameter("@CENTER_CODE", Data.CENTER_CODE));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblCLASSROOM_Update]
		public void tblCLASSROOM_Update(tblCLASSROOMInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblCLASSROOM_Update", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CLASSROOM_CODE", Data.CLASSROOM_CODE));
				cmd.Parameters.Add(new SqlParameter("@CLASSROOM_NAME", Data.CLASSROOM_NAME));
				cmd.Parameters.Add(new SqlParameter("@CENTER_CODE", Data.CENTER_CODE));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblCLASSROOM_Delete]
		public void tblCLASSROOM_Delete(string CLASSROOM_CODE)
		{
			using (var cmd = new SqlCommand("sp_tblCLASSROOM_Delete", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CLASSROOM_CODE",CLASSROOM_CODE));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
	}
}